﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 立顶申请信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_APP_PROINFO: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_APP_PROINFO()
		{}
		#region Model
		private long _id=0;
		private long _reginfoid=0;
		private string _custname="";
        private string _doctype = "";
        private string _doctypename = "";
        private string _custno = "";
        private string _applyno = "";
        private DateTime? _appdate=DateTime.Now;
		private int _loantype=0;
		private long _salesmanid=0;
        private string _salesman = "";
		private long _depid=0;
        private string _depname = "";
		private int _busstype=0;
		private long _productid=0;
        private string _productname = "";
		private long _mediatorid=0;
        private string _mediator = "";
        private string _mediatoraccount = "";
        private string _mediatortel = "";
        private string _source = "";
		private int _isspecial=0;
		private long _specid=0;
        private string _contact = "";
        private string _contracttel = "";
        private string _contracttel2 = "";
		private decimal _amount=(decimal)0.00;
		private int _loanphase=0;
		private int _loanphaestype=0;
        private decimal _rate = (decimal)0.00;
        private decimal _managefeerate = (decimal)0.00;
        private decimal _generalrate = (decimal)0.00;
        private decimal _loanfee = (decimal)0.00;
		private int _status=0;
		private string _cancelby="";
        private DateTime? _canceldate = DateTime.Now;
		private string _cancelreason="";
		private int _backstatus=0;
        private DateTime? _backdate = DateTime.Now;
		private string _backby="";
		private string _backreason="";
		private int _flowstatus=0;
		private int _systemid=0;
		private string _siteno="";
		private string _sitename="";
		private long _siteid=0;
		private int _sparefield1=0;
		private string _sparefield2="";
		private string _sparefield3="";
      

        

		/// <summary>
		/// 主键ID主键ID，唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 申请登记记录ID
		/// </summary>
		[DataMember]
		public long REGINFOID
		{
			get{return _reginfoid;}
			set{
				if ( _reginfoid!= value)
				{
					 _reginfoid = value;
					OnPropertyChanged("REGINFOID");
				}
			}
		}
		/// <summary>
		/// 客户名称
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 证件类型只存编码
		/// </summary>
		[DataMember]
		public string DOCTYPE
		{
			get{return _doctype;}
			set{
				if ( _doctype!= value)
				{
					 _doctype = value;
					OnPropertyChanged("DOCTYPE");
				}
			}
		}
		/// <summary>
		/// 证件类型名称下拉选择，选择‘身份证、组织机构代码、军官证’，默认为身份证
		/// </summary>
		[DataMember]
		public string DOCTYPENAME
		{
			get{return _doctypename;}
			set{
				if ( _doctypename!= value)
				{
					 _doctypename = value;
					OnPropertyChanged("DOCTYPENAME");
				}
			}
		}
		/// <summary>
		/// 证件号码
		/// </summary>
		[DataMember]
		public string CUSTNO
		{
			get{return _custno;}
			set{
				if ( _custno!= value)
				{
					 _custno = value;
					OnPropertyChanged("CUSTNO");
				}
			}
		}
		/// <summary>
		/// 申请编号自动获取，编码规则‘年+月+4位流水’，如‘0305060001’，不可修改
		/// </summary>
		[DataMember]
		public string APPLYNO
		{
			get{return _applyno;}
			set{
				if ( _applyno!= value)
				{
					 _applyno = value;
					OnPropertyChanged("APPLYNO");
				}
			}
		}
		/// <summary>
		/// 申请日期
		/// </summary>
		[DataMember]
        public DateTime? APPDATE
		{
			get{return _appdate;}
			set{
				if ( _appdate!= value)
				{
					 _appdate = value;
					OnPropertyChanged("APPDATE");
				}
			}
		}
		/// <summary>
		/// 贷款类型1新增贷款，2续贷，3再贷
		/// </summary>
		[DataMember]
		public int LOANTYPE
		{
			get{return _loantype;}
			set{
				if ( _loantype!= value)
				{
					 _loantype = value;
					OnPropertyChanged("LOANTYPE");
				}
			}
		}
		/// <summary>
		/// 项目经理记录ID
		/// </summary>
		[DataMember]
		public long SALESMANID
		{
			get{return _salesmanid;}
			set{
				if ( _salesmanid!= value)
				{
					 _salesmanid = value;
					OnPropertyChanged("SALESMANID");
				}
			}
		}
		/// <summary>
		/// 项目经理
		/// </summary>
		[DataMember]
		public string SALESMAN
		{
			get{return _salesman;}
			set{
				if ( _salesman!= value)
				{
					 _salesman = value;
					OnPropertyChanged("SALESMAN");
				}
			}
		}
		/// <summary>
		/// 所属部门记录ID
		/// </summary>
		[DataMember]
		public long DEPID
		{
			get{return _depid;}
			set{
				if ( _depid!= value)
				{
					 _depid = value;
					OnPropertyChanged("DEPID");
				}
			}
		}
		/// <summary>
		/// 所属部门
		/// </summary>
		[DataMember]
		public string DEPNAME
		{
			get{return _depname;}
			set{
				if ( _depname!= value)
				{
					 _depname = value;
					OnPropertyChanged("DEPNAME");
				}
			}
		}
		/// <summary>
		/// 业务种类单选项，包括：1典当、2期间借款、3赎楼、4租赁，必填项
		/// </summary>
		[DataMember]
		public int BUSSTYPE
		{
			get{return _busstype;}
			set{
				if ( _busstype!= value)
				{
					 _busstype = value;
					OnPropertyChanged("BUSSTYPE");
				}
			}
		}
		/// <summary>
		/// 贷款产品记录ID
		/// </summary>
		[DataMember]
		public long PRODUCTID
		{
			get{return _productid;}
			set{
				if ( _productid!= value)
				{
					 _productid = value;
					OnPropertyChanged("PRODUCTID");
				}
			}
		}
		/// <summary>
		/// 贷款产品名称
		/// </summary>
		[DataMember]
		public string PRODUCTNAME
		{
			get{return _productname;}
			set{
				if ( _productname!= value)
				{
					 _productname = value;
					OnPropertyChanged("PRODUCTNAME");
				}
			}
		}
		/// <summary>
		/// 中介人记录ID
		/// </summary>
		[DataMember]
		public long MEDIATORID
		{
			get{return _mediatorid;}
			set{
				if ( _mediatorid!= value)
				{
					 _mediatorid = value;
					OnPropertyChanged("MEDIATORID");
				}
			}
		}
		/// <summary>
		/// 中介人
		/// </summary>
		[DataMember]
		public string MEDIATOR
		{
			get{return _mediator;}
			set{
				if ( _mediator!= value)
				{
					 _mediator = value;
					OnPropertyChanged("MEDIATOR");
				}
			}
		}
		/// <summary>
		/// 中介人账号银行和账号填写在一起
		/// </summary>
		[DataMember]
		public string MEDIATORACCOUNT
		{
			get{return _mediatoraccount;}
			set{
				if ( _mediatoraccount!= value)
				{
					 _mediatoraccount = value;
					OnPropertyChanged("MEDIATORACCOUNT");
				}
			}
		}
		/// <summary>
		/// 中介人手机号
		/// </summary>
		[DataMember]
		public string MEDIATORTEL
		{
			get{return _mediatortel;}
			set{
				if ( _mediatortel!= value)
				{
					 _mediatortel = value;
					OnPropertyChanged("MEDIATORTEL");
				}
			}
		}
		/// <summary>
		/// 来源渠道下拉输入，必填项，默认包括‘公司转介、中介介绍、自主开发、自来客户、其他’，如果来源渠道选择‘中介介绍’，则必须输入‘中介人’（待定）
		/// </summary>
		[DataMember]
		public string SOURCE
		{
			get{return _source;}
			set{
				if ( _source!= value)
				{
					 _source = value;
					OnPropertyChanged("SOURCE");
				}
			}
		}
		/// <summary>
		/// 存在特批0否，1是，默认为0
		/// </summary>
		[DataMember]
		public int ISSPECIAL
		{
			get{return _isspecial;}
			set{
				if ( _isspecial!= value)
				{
					 _isspecial = value;
					OnPropertyChanged("ISSPECIAL");
				}
			}
		}
		/// <summary>
		/// 特批申请记录ID
		/// </summary>
		[DataMember]
		public long SPECID
		{
			get{return _specid;}
			set{
				if ( _specid!= value)
				{
					 _specid = value;
					OnPropertyChanged("SPECID");
				}
			}
		}
		/// <summary>
		/// 联系人
		/// </summary>
		[DataMember]
		public string CONTACT
		{
			get{return _contact;}
			set{
				if ( _contact!= value)
				{
					 _contact = value;
					OnPropertyChanged("CONTACT");
				}
			}
		}
		/// <summary>
		/// 联系人手机1
		/// </summary>
		[DataMember]
		public string CONTRACTTEL
		{
			get{return _contracttel;}
			set{
				if ( _contracttel!= value)
				{
					 _contracttel = value;
					OnPropertyChanged("CONTRACTTEL");
				}
			}
		}
		/// <summary>
		/// 联系人手机2
		/// </summary>
		[DataMember]
		public string CONTRACTTEL2
		{
			get{return _contracttel2;}
			set{
				if ( _contracttel2!= value)
				{
					 _contracttel2 = value;
					OnPropertyChanged("CONTRACTTEL2");
				}
			}
		}
		/// <summary>
		/// 借款金额
		/// </summary>
		[DataMember]
		public decimal AMOUNT
		{
			get{return _amount;}
			set{
				if ( _amount!= value)
				{
					 _amount = value;
					OnPropertyChanged("AMOUNT");
				}
			}
		}
		/// <summary>
		/// 期限
		/// </summary>
		[DataMember]
		public int LOANPHASE
		{
			get{return _loanphase;}
			set{
				if ( _loanphase!= value)
				{
					 _loanphase = value;
					OnPropertyChanged("LOANPHASE");
				}
			}
		}
		/// <summary>
		/// 期限类型0天，1月，默认为1
		/// </summary>
		[DataMember]
		public int LOANPHAESTYPE
		{
			get{return _loanphaestype;}
			set{
				if ( _loanphaestype!= value)
				{
					 _loanphaestype = value;
					OnPropertyChanged("LOANPHAESTYPE");
				}
			}
		}
		/// <summary>
		/// 利率当业务种类为赎楼时，则为手续费率
		/// </summary>
		[DataMember]
		public decimal RATE
		{
			get{return _rate;}
			set{
				if ( _rate!= value)
				{
					 _rate = value;
					OnPropertyChanged("RATE");
				}
			}
		}
		/// <summary>
		/// 管理费率
		/// </summary>
		[DataMember]
		public decimal MANAGEFEERATE
		{
			get{return _managefeerate;}
			set{
				if ( _managefeerate!= value)
				{
					 _managefeerate = value;
					OnPropertyChanged("MANAGEFEERATE");
				}
			}
		}
		/// <summary>
		/// 综合费率
		/// </summary>
		[DataMember]
		public decimal GENERALRATE
		{
			get{return _generalrate;}
			set{
				if ( _generalrate!= value)
				{
					 _generalrate = value;
					OnPropertyChanged("GENERALRATE");
				}
			}
		}
		/// <summary>
		/// 手续费
		/// </summary>
		[DataMember]
		public decimal LOANFEE
		{
			get{return _loanfee;}
			set{
				if ( _loanfee!= value)
				{
					 _loanfee = value;
					OnPropertyChanged("LOANFEE");
				}
			}
		}
		/// <summary>
		/// 状态10保存，
        ///11提交，
        ///20部门经理审批，
        ///21总经理审批，
        ///31风控分配，
        ///32风控审批，
        ///33风控总经理审批，
        ///41总经理/总裁审批，
        ///50审议
        ///60合同签订
        ///70放款
        ///80收回
        ///90结清
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 取消人
		/// </summary>
		[DataMember]
		public string CANCELBY
		{
			get{return _cancelby;}
			set{
				if ( _cancelby!= value)
				{
					 _cancelby = value;
					OnPropertyChanged("CANCELBY");
				}
			}
		}
		/// <summary>
		/// 取消时间
		/// </summary>
		[DataMember]
        public DateTime? CANCELDATE
		{
			get{return _canceldate;}
			set{
				if ( _canceldate!= value)
				{
					 _canceldate = value;
					OnPropertyChanged("CANCELDATE");
				}
			}
		}
		/// <summary>
		/// 取消原因
		/// </summary>
		[DataMember]
		public string CANCELREASON
		{
			get{return _cancelreason;}
			set{
				if ( _cancelreason!= value)
				{
					 _cancelreason = value;
					OnPropertyChanged("CANCELREASON");
				}
			}
		}
		/// <summary>
		/// 退回状态10立项申请
        ////20业务部审批
        ////30风控审批
        ////40管理层审批
        ////50审议
		/// </summary>
		[DataMember]
		public int BACKSTATUS
		{
			get{return _backstatus;}
			set{
				if ( _backstatus!= value)
				{
					 _backstatus = value;
					OnPropertyChanged("BACKSTATUS");
				}
			}
		}
		/// <summary>
		/// 退回时间
		/// </summary>
		[DataMember]
        public DateTime? BACKDATE
		{
			get{return _backdate;}
			set{
				if ( _backdate!= value)
				{
					 _backdate = value;
					OnPropertyChanged("BACKDATE");
				}
			}
		}
		/// <summary>
		/// 退回人
		/// </summary>
		[DataMember]
		public string BACKBY
		{
			get{return _backby;}
			set{
				if ( _backby!= value)
				{
					 _backby = value;
					OnPropertyChanged("BACKBY");
				}
			}
		}
		/// <summary>
		/// 退回原因
		/// </summary>
		[DataMember]
		public string BACKREASON
		{
			get{return _backreason;}
			set{
				if ( _backreason!= value)
				{
					 _backreason = value;
					OnPropertyChanged("BACKREASON");
				}
			}
		}
		/// <summary>
		/// 流程状态
		/// </summary>
		[DataMember]
		public int FLOWSTATUS
		{
			get{return _flowstatus;}
			set{
				if ( _flowstatus!= value)
				{
					 _flowstatus = value;
					OnPropertyChanged("FLOWSTATUS");
				}
			}
		}
		/// <summary>
		/// 所属子系统
		/// </summary>
		[DataMember]
		public int SYSTEMID
		{
			get{return _systemid;}
			set{
				if ( _systemid!= value)
				{
					 _systemid = value;
					OnPropertyChanged("SYSTEMID");
				}
			}
		}
		/// <summary>
		/// 所属网点
		/// </summary>
		[DataMember]
		public string SITENO
		{
			get{return _siteno;}
			set{
				if ( _siteno!= value)
				{
					 _siteno = value;
					OnPropertyChanged("SITENO");
				}
			}
		}
		/// <summary>
		/// 所属网点名称
		/// </summary>
		[DataMember]
		public string SITENAME
		{
			get{return _sitename;}
			set{
				if ( _sitename!= value)
				{
					 _sitename = value;
					OnPropertyChanged("SITENAME");
				}
			}
		}
		/// <summary>
		/// 所属网点记录ID
		/// </summary>
		[DataMember]
		public long SITEID
		{
			get{return _siteid;}
			set{
				if ( _siteid!= value)
				{
					 _siteid = value;
					OnPropertyChanged("SITEID");
				}
			}
		}
		/// <summary>
		/// 预留字段1
		/// </summary>
		[DataMember]
		public int SPAREFIELD1
		{
			get{return _sparefield1;}
			set{
				if ( _sparefield1!= value)
				{
					 _sparefield1 = value;
					OnPropertyChanged("SPAREFIELD1");
				}
			}
		}
		/// <summary>
		/// 预留字段2
		/// </summary>
		[DataMember]
		public string SPAREFIELD2
		{
			get{return _sparefield2;}
			set{
				if ( _sparefield2!= value)
				{
					 _sparefield2 = value;
					OnPropertyChanged("SPAREFIELD2");
				}
			}
		}
		/// <summary>
		/// 预留字段3
		/// </summary>
		[DataMember]
		public string SPAREFIELD3
		{
			get{return _sparefield3;}
			set{
				if ( _sparefield3!= value)
				{
					 _sparefield3 = value;
					OnPropertyChanged("SPAREFIELD3");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

